package com.example.greendao;

import de.greenrobot.daogenerator.DaoGenerator;
import de.greenrobot.daogenerator.Entity;
import de.greenrobot.daogenerator.Schema;

/**
 * Created by hui on 2016/4/13.
 */
public class greenFileCreator {
    public static void main(String[] args) throws Exception {

        Schema schema = new Schema(3, "com.database.dao");

        addAccount(schema);
        addNotepad(schema);
        addSchedule(schema);

        new DaoGenerator().generateAll(schema, "C:\\Users\\hui\\AndroidStudioProjects\\MyApplication\\greendaotest\\src\\main\\java");
    }

    private static void addAccount(Schema schema) {
        Entity account = schema.addEntity("Account");//记账
        account.addIdProperty().autoincrement();
        account.addDoubleProperty("total");//总金额
        account.addDoubleProperty("monthUsing");//本月已用金额
        account.addStringProperty("remarks");//备注
        account.addDoubleProperty("payOrIncome");//花费或者增加金额
        account.addDateProperty("markDate");//记录时间
    }

    private static void addNotepad(Schema schema) {
        Entity note = schema.addEntity("Notepad");//记事本
        note.addIdProperty().autoincrement();
        note.addStringProperty("note");//记事，内容
        note.addStringProperty("markDate");//记录时间
    }

    private static void addSchedule(Schema schema){
        Entity schedule = schema.addEntity("Schedule");//日程
        schedule.addIdProperty().autoincrement();
        schedule.addStringProperty("noteTitle");//事件名
        schedule.addStringProperty("location");//地点
        schedule.addStringProperty("remarks");//备注
        schedule.addDateProperty("markDate");//记录时间
    }
}
